<!DOCTYPE html>
<html class="login-bg" style="background-image: url({{env('IMAGE_DOMAIN')}}images/shop/bgs/landscape.jpg);">
<head>
	<title>翻贝网商家后台</title>
    <meta name="keywords" content="翻倍花，O2O，第三方推广，服务平台">
    <meta name="description" content="翻贝网致力于打造国内最具公信力的第三方推广和服务平台">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	
    <!-- bootstrap -->
    <link href="{{env('CSS_DOMAIN')}}css/bootstrap/bootstrap.css" rel="stylesheet">
    <link href="{{env('CSS_DOMAIN')}}css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet">
    <!-- global styles -->
    <link href="{{env('CSS_DOMAIN')}}css/compiled/layout.css" rel="stylesheet" type="text/css">
    <link href="{{env('CSS_DOMAIN')}}css/compiled/elements.css" rel="stylesheet" type="text/css" >
    <link href="{{env('CSS_DOMAIN')}}css/compiled/icons.css" rel="stylesheet" type="text/css">
    <!-- libraries -->
    <link href="{{env('CSS_DOMAIN')}}css/lib/font-awesome.css" rel="stylesheet" type="text/css">
    <!-- this page specific styles -->
    <link href="{{env('CSS_DOMAIN')}}css/compiled/signin.css" rel="stylesheet" type="text/css" media="screen" />

    <style>
        .login-wrapper .title{font-size: 16px;margin-bottom: 30px;}
        .login_way{overflow: hidden;margin-bottom: 30px;font-size: 14px;}
        .get_code{float: left;width: 100px;height: 40px;background-color: #9955c6;line-height: 40px;border-radius: 5px;color: #fff;margin-left: 25px;cursor: pointer;}
        .phone_login{display: none;}
        .wrong_message{color: red;font-size: 14px;display: none;}
        .success_promit{height: 60px;padding: 0 40px;position: absolute;top: 270px;left: 50%;background-color: #fff;border-radius: 5px;z-index: 100;box-shadow: 0px 0px 5px 5px rgba(128,128,128,0.5);overflow: hidden;width: 204px;margin-left: -102px;display: none;}
        .success_promit img{float: left;width: 30px;margin: 15px 20px 15px 0;}
        .success_promit span{float: left;color: #3f3f3f;font-size: 18px;line-height: 60px;}
    </style>
</head>
<body>
    <p class="success_promit">
        <img src="{{env('IMAGE_DOMAIN')}}images/shop/bgs/finish.png" alt="">
        <span>创建成功</span>
    </p>
    <div class="login-wrapper">
        <div class="title">
            <p>hi，{{$name}}！你的账号尚未设置登录密码！</p>
            <p>请先完成登录密码设置，完成后即可进入翻贝网商家后台。</p>
        </div>
        <div class="box">
            <form class="password_login" action="" method="">
                <div class="content-wrap">
                    <p class="login_way">密码长度6-16位</p>
                    <input maxlength="16" class="form-control" type="password" name="password" placeholder="创建密码">
                    <input maxlength="16" class="form-control" type="password" name="confirmpassword" placeholder="确认密码">
                    <p class="wrong_message"></p>
                    <input style="background: #9955c6;" type="button" class="btn-glow primary login" id="submit_login" value="确定" />
                </div>
            </form>
        </div>
    </div>

	<!-- scripts -->
    <script  src="{{env('JS_DOMAIN')}}js/jquery-1.11.1.min.js?v={{env('JS_VERSION')}}" type="text/javascript"></script>
    <script src="{{env('JS_DOMAIN')}}js/bootstrap.min.js"></script>
    <script src="{{env('JS_DOMAIN')}}js/theme.js"></script>

    <!-- pre load bg imgs -->
    <script type="text/javascript">
        $(function () {
            // bg switcher
            var $btns = $(".bg-switch .bg");
            $btns.click(function (e) {
                e.preventDefault();
                $btns.removeClass("active");
                $(this).addClass("active");
                var bg = $(this).data("img");

                $("html").css("background-image", "url('{{env('IMAGE_DOMAIN')}}images/shop/bgs/" + bg + "')");
            });
        });
        $("#submit_login").click(function() {
            $(".wrong_message").html('');
            var password = $("input[name='password']").val();
            var confirmpassword = $("input[name='confirmpassword']").val();
            if(password.length < 6){
                $(".wrong_message").show();
                $(".wrong_message").html('请输入6-16位密码');
                $("input[name='password']").val('');
                $("input[name='confirmpassword']").val('');
                return false;
            }else if(password!=confirmpassword){
                $(".wrong_message").show();
                $(".wrong_message").html('两次输入密码不正确');
                $("input[name='password']").val('');
                $("input[name='confirmpassword']").val('');
                return false;
            }else{
                $.ajax({
                    url :"/shop/user/password/set",
                    type:'POST',
                    data : {
                        password:password,
                        confirmpassword:confirmpassword
                    },
                    dataType:'json',
                    async:false,
                    success:function(data){
                        if (data.status == "success") {
                            $(".wrong_message").hide();
                            $(".success_promit").show();
                            setTimeout(function(){
                                window.location.reload();
                            },1000)
                        } else {
                            $(".wrong_message").show();
                            $(".wrong_message").html(data.message);
                        }
                    }
                });
            }
        });
    </script>
</body>
</html>